<template>
  <CommonTablePage
      :tableInfo="tableInfo"
      :insertTableInfo="insertTableInfo"
      :tableReqUrl="tableReqUrl"
      @onGetDeleteReqUrl="getDeleteReqUrl"
  />
</template>

<script lang="ts" setup>
import {ref, reactive, onBeforeMount, provide} from "vue";
import CommonTablePage from "@/components/common/CommonTablePage.vue";

const tableReqUrl = ref("/api/foodCategory")

const tableInfo = ref([
  {prop: "categoryId", label: "类别号"},
  {prop: "categoryName", label: "名称"},
  {prop: "categoryEasyBad", label: "是否易变质", map: {true: "是", false: "否"}}
]);

const insertTableInfo = ref([
  {prop: "categoryName", label: "名称"},
  {
    prop: "categoryEasyBad", label: "是否易变质", isSelect: true, select: {key: "key", label: "label",},
    options: [{key: true, label: "是"}, {key: false, label: "否"}]
  }
]);

// 删除请求url
const getDeleteReqUrl = async ({value, reFun}) => {
  reFun(`${tableReqUrl.value}/${value.categoryId}`);
};


</script>

<style scoped>

</style>